package com.haruhi.bot.job;

import com.haruhi.bot.job.thread.PutPicFromHaruhiThread;
import com.haruhi.bot.service.PixPictureService;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * 从haruhi库获取图片到真寻库
 */
public class PutPixJob {


    private static ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
    // 12小时执行一次
    private static long period = 1000 * 60 * 60 * 12;
    // 延迟30分钟
    private static long initialDelay = 1000 * 60 * 30;


    public static void start(PixPictureService service){
        pool.scheduleAtFixedRate(new PutPicFromHaruhiThread(service),initialDelay,period, TimeUnit.MILLISECONDS);
    }

}